<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #000000;
}
body {
	background-color: #F3F8FC;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a {
	font-family: 宋体;
	font-size: 12px;
	color: #000000;
}
a:visited {
	color: #000000;
}
a:hover {
	color: #FF3300;
}
a:active {
	color: #000000;
}
.lxjx {
	margin-right: 15px;
	margin-bottom: 15px;
	float: left;
}

.tbl05 {
	padding-left: 5px;<!--一级栏目td样式-->
}
.tbl15 {
	padding-left: 15px;<!--二级栏目td样式-->
}
.tbl25 {
	padding-left: 25px;<!--三级栏目td样式-->
}
.tbl35 {
	padding-left: 35px;<!--四级栏目td样式-->
}
-->
</style>
</head>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>

<body class="m_6" style="over" onload="errInfo();">
<form method="post">
<input type="hidden" name="info" id="info" value="${info}"/>
<div id="main">
	<div class="zdsz" id="select1">
		<div class="tab"><h3 onclick="f1();">管理资源</h3><h3 onclick="f2();">新建资源</h3><h3  class="sel" onclick="f3();">设置禁用资源</h3></div>
		<div class="zd_gut">
		<ul class="block">
		<li>
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tab_1 center">
				  <tr>
					<td align="center" colspan="2"><button onclick="managerAsset();">确定</button> </td>
				  </tr>
				  <tr>
					<td class="w1 bg4" width="45%">角色：<span onclick="checkRole();" style="cursor: pointer;">[全选]</span>/<span onclick="checkRoleNo();" style="cursor: pointer;">[反选]</span> </td>
					<td align="left"><s:iterator value="roles" status="role"><input name="role" type="checkbox" value="${roleId}"/>${roleName}</s:iterator> </td>
				  </tr>
				</table></li>
				<div align="center"><div id="err"></div> </div>
				<li >
				
				<s:iterator value="list" status="o" id="obj">
				<table width="300" border="0" cellspacing="0" cellpadding="0" class="tab_m left fl_l m_r">
                        <tr>
                          <td  class="font14"><input name="asset" id="asset"  type="checkbox" value="${obj[1].assetId}" />
                              <img src="${ctx}/images/index/008.gif"/>${obj[0]}--${obj[1].assetName}</td>
                        </tr>
				
				</table>
				
				<s:if test="o.index+1 % 4 == 0"><br/><br/></s:if>
				
				</s:iterator>
		</li>
		</ul>
		<div class="bihe"></div>
		</div>
	</div>
</div>
</form>
</body>
</html>
<script type="text/javascript">
	function managerAsset(){
		document.forms[0].action="${ctx}/asset/asset!setAssetIdGroup.action";
		document.forms[0].submit();
	}

	function deleteRole(str){
		if(window.confirm("确定要删除该角色?")){
			window.location = "${ctx}/asset/asset!deleteSysAsset.action?baseRole.roleId="+str;
		}
	}
	
	function f1(){
		window.location = "${ctx}/asset/asset!index.action";
	}
	function f2(){
		window.location = "${ctx}/asset/asset!preCreateSysAsset.action";
	}
	function f3(){
		window.location = "${ctx}/asset/asset!preSetAssetIdGroup.action";
	}
	
function check_all(id,index){
	var menu = document.getElementById(index);
	var temp = document.getElementsByName("func");
		for(var i=0;i<temp.length;i++){
			if(id.checked){
				var checkName = temp[i].id;
				if(checkName.indexOf(index) != -1){
					temp[i].checked = true;
				}
			}else{
				var checkName1 = temp[i].id;
				if(checkName1.indexOf(index) != -1){
					temp[i].checked = false;
				}
			}
		}
	}
	
	function checkRole(){
	
		var temp = document.getElementsByName("role");
			for(var i=0;i<temp.length;i++){
				temp[i].checked = true;
			}
	}
	function checkRoleNo(){
	
		var temp = document.getElementsByName("role");
			for(var i=0;i<temp.length;i++){
				temp[i].checked = false;
			}
	}
	
	function errInfo(){
	
		var info = document.getElementById("info").value;
		
		if(info == 'asset_1'){
		   document.getElementById("err").innerHTML ="<font color='red'>成功!</div>";
		   
		}else if(info == 'asset_6'){
			document.getElementById("err").innerHTML ="<font color='red'>请选择角色!</div>";
		}else if(info == 'asset_7'){
			document.getElementById("err").innerHTML ="<font color='red'>请选择禁用资源!</div>";
		}
	}
</script>
